package org.example.struct.array;

/**
 * @author liyishan
 * @date 2024/2/2 10:12
 * @apiNote
 */

public class Test01446MaxPower {
    public static void main(String[] args) {
        String s = "cc";
        System.out.println(maxPower(s));
    }

    public static int maxPower(String s) {
        int ans = 1;
        int maxLen = 1;
        int n = s.length();
        for (int i = 1; i < n; i++) {
            if(s.charAt(i) == s.charAt(i-1)){
                ans++;
            }else{
                maxLen = Math.max(maxLen, ans);
                ans = 1;
            }
        }
        return Math.max(maxLen, ans);
    }

}
